<?php
//  This file is part of EkkinCMS.
//
//  EkkinCMS is free software: you can redistribute it and/or modify
//  it under the terms of the GNU General Public License as published by
//  the Free Software Foundation, either version 3 of the License, or
//  (at your option) any later version.
//
//  EkkinCMS is distributed in the hope that it will be useful,
//  but WITHOUT ANY WARRANTY; without even the implied warranty of
//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//  GNU General Public License for more details.
//
//  You should have received a copy of the GNU General Public License
//  along with EkkinCMS.  If not, see <http://www.gnu.org/licenses/>.

include("templates/templates.php");
include("admin/image-browser.php");


$configure_html = "<h3>"._("Site Settings")."</h3>
<form method='POST' action='$save_conf_link'>
<table>
    <tr>
        <td> "._("Site template")." : </td>
        <td><select name='site_template'>";
foreach ($site_templates as $t){
    if ($t == $template) {
        $configure_html .= "<option value='$t' selected>$t</option>";
    } else {
        $configure_html .= "<option value='$t'>$t</option>";
    }
}


if ($main_site_gtrans == "true"){
	$trans_check = "checked";
}

$configure_html .= "</select>
        </td>
    </tr>
    <tr>
        <td> "._("Site title")." : </td>
        <td> <input name='site_title' type='text' value='$main_site_title'/></td>
    </tr>
    <tr>
        <td> "._("Site title image (if supported by template)")." : </td>
        <td> <img id='site_image_prev' src='$main_site_image' width='50' height='50'/><input name='site_image' id='site_image' type='hidden' value='$main_site_image'/> <a href='#' onclick='show_imagebrowser(set_site_image)'>&nbsp;&nbsp;"._("Change")."</a></td>
    </tr>
	<tr>
		<td> "._("Email address (used for mail forms)")." : </td>
		<td> <input name='site_mail' type='text' value='$main_site_mail'/></td>

	</tr>
	<tr>
		<td> "._("Use Google Translate as fallback translation")." : </td>
		<td> <input name='site_gtrans' type='checkbox' value='true' $trans_check /></td>

	</tr>

</table>
<br/><br/><br/>
<input name='submit-conf' type='submit' value='"._("Save")."'> | <a href='' onclick='return show_configuration()'>"._("Cancel")."</a>
</form>";

$configure_html = str_replace("\n", "\\", $configure_html);
$return_html = $configure_html;
$div_id = "admin-configure";
$im_dir = "${site_dir}/user_files/images";
$imb_head = get_imagebrowser($div_id, $return_html, "$im_dir", "");


$site_head_extra .= "<script>
function show_configuration(){
	var thediv=document.getElementById('admin-configure');
	var blanket=document.getElementById('admin-blanket');
	if(thediv.style.display == \"none\"){
		thediv.style.display = \"\";
		blanket.style.display = \"\";
		thediv.innerHTML = \"$configure_html\";
	}else{
		thediv.style.display = \"none\";
		thediv.innerHTML = '';
		blanket.style.display = \"none\";
	}
	return false;
}

function set_site_image(im){
	var i = document.getElementById('site_image');
	i.value = '$im_dir/'+im;
	document.getElementById('site_image_prev').src = '$im_dir/thumbs/'+im;
}


</script>
$imb_head
";




?>
